package com.jar.netty_demo.NIO.ZeroCOPY;


import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.nio.charset.Charset;

public class Server {
	public static void main(String[] args) {
		try {
			ServerSocket serverSocket = new ServerSocket(7001);
			while (true) {
				Socket socket = serverSocket.accept();
				DataInputStream dataInputStream = new DataInputStream(socket.getInputStream());
				byte[] byteArray = new byte[1024];

			/*while ((readCount = dataInputStream.read(byteArray, 0, byteArray.length ))!=-1) {
				int read = dataInputStream.read();
				System.out.println(new String(byteArray, Charset.forName("UTF-8")));
			}*/
				while (true) {
					int read = 0;

					read = dataInputStream.read(byteArray, 0, byteArray.length);

					if (read == -1) {
						break;
					}


				}
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
